package dk.itu.mmad.travelapp3;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class ChInPort_Activity extends Activity {
String tag = "ChinPort";
static String chIn;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Log.i(tag, "I tried to create a start chinport layout");
		setContentView(R.layout.activity_chinport);
//		Button button  = (Button) findViewById(R.id.chinbutton);
//		button.setOnClickListener(new View.OnClickListener() {
//			@Override
//			public void onClick(View v) {
//				Log.i(tag, "I tried to create a listener");
//				//EditText checki = (EditText) getText(R.id.checkinstation);
//				Intent intent = new Intent(ChInPort_Activity.this, ChOut_Activity.class);
//				EditText ed = (EditText) findViewById(R.id.chinstation);
//				chIn = ed.getText().toString();
//				intent.putExtra("ci", chIn);
//				Log.i(tag, "I tried to create a listener again");
//				startActivity(intent);
//			}
//		});
	}
	@Override
	public void onStart(){
		super.onStart();		
//		if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE){
//			Intent intent = new Intent(this, MainActivity.class);
//			startActivity(intent);
//		}else{
		Log.i(tag, "I tried to create a button");
		Button button  = (Button) findViewById(R.id.chinbutton);
		button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Log.i(tag, "I tried to create a listener");
				//EditText checki = (EditText) getText(R.id.checkinstation);
				Intent intent = new Intent(ChInPort_Activity.this, ChOut_Activity.class);
				EditText ed = (EditText) findViewById(R.id.chinstation);
				chIn = ed.getText().toString();
				intent.putExtra("ci", chIn);
				Log.i(tag, "I tried to create a listener again");
				startActivity(intent);
			}
		});
//		}
	}
	@Override
	public void onStop(){
	super.onStop();	
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_chinport, menu);
		return true;
	}

	

}
